package com.augmentum.oes.util;

import java.text.MessageFormat;

public final class MessageUtils {

    public static final int INTERNAL_SERVER_ERROR = 500;
    public static final int PAGE_ERROR = 404;

    public static final int REQUIRED_FIELD_ERROR = 100001;

    public static final int DB_ACCESS_ERROR = 200001;
    public static final int DB_LOAD_DRIVER_ERROR = 200002;
    public static final int DB_GET_CONNECT_ERROR = 200003;
    public static final int DB_CLOSE_ERROR = 200004;

    public static final int ENTITY_NOT_FOUND = 300001;
    public static final int ENTITY_CREATE_FAILED = 300002;
    public static final int ENTITY_UPDATE_FAILED = 300003;
    public static final int ENTITY_DELETE_FAILED = 300004;

    public static final int LOAD_PROPERTIES_FILE_FAIL = 400001;
    public static final int CLOSE_STREAM_FAIL = 400002;
    public static final int REFLECT_FAIL = 400003;
    public static final int LOAD_XML_FAIL = 400004;

    public static final String ENTITY_USER = "User";
    public static final String ENTITY_QUESTION = "Question";

    public static String buildMessage(int code, Object... message) {
        String msg = PropertyUtil.getMsg(String.valueOf(code));
        return MessageFormat.format(msg, message);
    }

}
